﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PacMan
{
    /// <summary>
    /// Provides the logic for character named Clyde.
    /// </summary>
    class Clyde : Character
    {
        public Clyde(int x, int y, int speed)
            : base(x, y, speed)
        {
            this.Width = 40;
            this.Height = 40;
        }

        /// <summary>
        /// Makes Clyde to chase Pacman.
        /// </summary>
        /// <param name="pacman"></param>
        public void Chase(Pacman pacman) 
        {
            if (pacman.X > this.X)
            {
                this.X += Speed;
                if (pacman.Y > this.Y)
                {
                    this.Y += Speed;
                }
                else 
                {
                    this.Y -= Speed;
                }
            }
            else 
            {
                this.X -= Speed;
                if (pacman.Y > this.Y)
                {
                    this.Y += Speed;
                }
                else 
                {
                    this.Y -= Speed;
                }
            }
            
        }
    }
}
